function* fn(initial) {
    console.log(initial);
    console.log(yield);
}

var g = fn('0');

console.log(g.next(1))
console.log(g.next(2))

// 0
// { value: undefined, done: false }
// 2
// { value: undefined, done: true }